package job3;
/*
模拟三个老师同时分发30份笔试试卷，每个老师相当于一个线程。
 */

public class Teacher implements Runnable {
    private int paperNum = 30;

    @Override
    public void run() {
        String name = Thread.currentThread().getName();
        while (true) {
            if (paperNum < 1) {
                break;
            }
            System.out.println(name+"老师发的第" +paperNum--+ "份笔试试卷");
        }
    }

    public static void main(String[] args) {
        Runnable t = new Teacher();
        Thread t1 = new Thread( t,"王一");
        Thread t2 = new Thread( t,"赵二");
        Thread t3 = new Thread(t,"张三");

        t1.start();
        t2.start();
        t3.start();
    }
}
